function DialogModifyDesign(container, item, options) {
  this._container = container;
  this._item = item;
  this._options = options;
  
  this._createElements();
};
DialogModifyDesign.prototype._createElements = function() {
  var gui, div, table, mtr, mtd, input, select,  unique = MiscUtils.unique();
  DOMUtils.removeChildElements(this._container);
  
  this._container.style.verticalAlign = 'top';
  
  var table = document.createElement('table');
  table.style.backgroundColor = '#eeeeee';
  table.style.padding = '10px 0';
  table.style.width = '773px';
  table.style.height = '10px';
  this._container.appendChild(table);
  
  tr = table.insertRow(-1);  
  td = tr.insertCell(-1);
  td.align = 'right';
  td.style.width = '30px';
  td.style.height = '25px';
  td.style.paddingLeft = '27px';
  td.style.verticalAlign = 'middle';
  td.style.fontWeight = 'bold';
  td.style.color = '#695f55';
  td.style.fontSize = '10pt';
  td.appendChild(document.createTextNode('Product'));
  
  td = tr.insertCell(-1);
  td.align = 'left';
  td.style.verticalAlign = 'middle';
  td.style.width = '300px';
  td.style.color = '#000';
  td.id = unique + '_product_td';
  
  td = tr.insertCell(-1);
  td.align = 'right';
  td.style.verticalAlign = 'middle';
  td.style.paddingRight = '10px';
  td.style.width = '30px';
  td.style.fontWeight = 'bold';
  td.style.color = '#695f55';
  td.style.fontSize = '10pt';
  td.appendChild(document.createTextNode('Quantity'));
  
  td = tr.insertCell(-1);
  td.style.width = '40px';
  td.id = unique + '_quantity_div';
  
  td = tr.insertCell(-1);
  
  if (this._item.selects) {
    if (this._item.selects.length == 0) {
      var table1 = document.createElement('table');
      table1.style.backgroundColor = '#eeeeee';
      table1.style.height = '10px';
      this._container.appendChild(table1);
    } else {
      var atable = document.createElement('table');
      atable.style.backgroundColor = '#eeeeee';
      atable.style.borderTop = 'solid 1px #B3B3BA';
      atable.style.borderBottom = 'solid 1px #B3B3BA';
      atable.style.padding = '10px 0';
      atable.style.width = '773px';
      atable.style.height = '10px';
      this._container.appendChild(atable);
      
      tr = atable.insertRow(-1);
      td = tr.insertCell(-1);
      td.style.width = '27px';
      td = tr.insertCell(-1);
      td.align = 'left';
      this._attributeTable = document.createElement('table');
      this._attributeTable.cellPadding = 0;
      this._attributeTable.cellSpacing = 0;
      this._attributeTable.style.width = '720px';
      td.appendChild(this._attributeTable);
      td = tr.insertCell(-1);
      td.style.width = '27px';
  
      while (this._attributeTable.rows.length > 0) {
        this._attributeTable.deleteRow(0);
      }
      var sample = DlmanageUtils.sample(this._item, this._options.samples);
      if (sample) {
//        sample = DlmanageUtils.sampleAttribute(this._item, sample);
        for (var i = 0, il = sample.attributes.length; i < il; i++) {
          var attribute = sample.attributes[i];
          atr = this._attributeTable.insertRow(-1);
          atd = atr.insertCell(-1);
          atd.style.width = '720px';
          atd.style.backgroundColor = '#faf9f4';
          atd.style.borderBottom = 'solid 2px #eee';
          atd.style.height = '24px';
          atd.align = 'right';
          var itable = document.createElement('table');
          itable.style.width = '720px';
          itable.cellPadding = 0;
          itable.cellSpacing = 0;
          atd.appendChild(itable);
          
          itr = itable.insertRow(-1);
          itd = itr.insertCell(-1);
          itd.style.width = '60px';
          var span = document.createElement('span');
          span.style.color = '#695f55';
          span.style.fontSize = '14px';
          span.style.fontFamily = '黑体';
          span.style.fontWeight = 'bold';
          span.style.margin = '0 0 0 5px';
          span.id = unique + '_' + i + '_name_div';
          itd.appendChild(span);
    
          for (var j = 0, jl = attribute.options.length; j < jl; j++) {
            var option = attribute.options[j];
            itd = itr.insertCell(-1);
            itd.style.borderLeft = 'dashed 1px #ccc';
            itd.style.height = '24px';
            itd.style.width = '58px';
            itd.style.cursor = 'pointer';
            itd.style.color = '#000000';
            itd.style.fontSize = '13px';
            itd.style.fontFamily = '宋体';
            itd.align = 'center';
            itd.id = unique + '_' + i + '_' + j + '_name_div';
          }
          itd = itr.insertCell(-1);
        }
      }
    }
  }
  
  var sample = DlmanageUtils.sample(this._item, this._options.samples);
  var gui = GuiDialogModifyDesign.instance(unique, sample);
  new HandleDialogModifyDesign(gui, this._item, this._options);
};